/*
 * Copyright @ JuCheap All rights reserved.
 * 
 * 功能描述:数据过滤模型文件(此文件为系统模板生成,请勿修改)
 * 作者: JuCheap
 * 时间: 04/03/2020 14:24:39
 */
using JuCheap.Core.Infrastructure.Extentions;
using System;

namespace JuCheap.Core.Model
{
    /// <summary>
    /// 登陆日志查询模型扩展
    /// </summary>	
    public partial class SysLoginLogFilter
    {
        /// <summary>
        /// 登陆日期范围
        /// </summary>
        [ExcludeField]
        public DateTime[] LoginDateRange { get; set; }

        /// <summary>
        /// 获取登陆日期开始日期
        /// </summary>
        /// <returns></returns>
        [ExcludeField]
        public DateTime? GetLoginStartDate()
        {
            if (LoginDateRange != null && LoginDateRange.Length >= 1)
            {
                var date = LoginDateRange[0];
                date = date.Date.AddMilliseconds(-1);
                return date;
            }
            return null;
        }

        /// <summary>
        /// 获取登陆日期结束日期
        /// </summary>
        /// <returns></returns>
        [ExcludeField]
        public DateTime? GetLoginEndDate()
        {
            if (LoginDateRange != null && LoginDateRange.Length >= 2)
            {
                var date = LoginDateRange[1];
                date = date.Date.AddDays(1);
                return date;
            }
            return null;
        }
    }
}
